package com.example.template.dao.mapper;

import com.example.template.bean.User;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Repository;

import java.sql.ResultSet;
import java.sql.SQLException;


/**
 *
 * @author xiaomin
 * @date 2018/4/12
 */
@Repository
public class UserMapper implements RowMapper<User> {

    @Nullable
    @Override
    public User mapRow(ResultSet resultSet, int i) throws SQLException {
        User bean = new User();
        bean.setId(resultSet.getInt("id"));
        bean.setName(resultSet.getString("name"));
        bean.setPassword(resultSet.getString("password"));
        return bean;
    }
}
